home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / dalla rivista / amiga.free / diropus4.12b_gpl / config / screen_arrows.c < prev    next >
C/C++ Source or Header  |  2000-01-27  |  6KB  |  221 lines

  1. /*
  2.  
  3. Directory Opus 4
  4. Original GPL release version 4.12
  5. Copyright 1993-2000 Jonathan Potter
  6.  
  7. This program is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU General Public License
  9. as published by the Free Software Foundation; either version 2
  10. of the License, or (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. All users of Directory Opus 4 (including versions distributed
  22. under the GPL) are entitled to upgrade to the latest version of
  23. Directory Opus version 5 at a reduced price. Please see
  24. http://www.gpsoft.com.au for more information.
  25.  
  26. The release of Directory Opus 4 under the GPL in NO WAY affects
  27. the existing commercial status of Directory Opus 5.
  28.  
  29. */
  30.  
  31. #include "config.h"
  32.  
  33. void showupdownslider()
  34. {
  35.     int x,y,ay[2],a,height;
  36.  
  37.     if (config->arrowsize[0]<8) config->arrowsize[0]=8;
  38.     else if (config->arrowsize[0]>20) config->arrowsize[0]=20;
  39.  
  40.     height=49-(config->arrowsize[0]*2);
  41.  
  42.     switch (config->arrowpos[0]) {
  43.         case 0:
  44.             y=y_off+35; ay[0]=y+height+4; ay[1]=ay[0]+config->arrowsize[0];
  45.             break;
  46.         case 1:
  47.             ay[0]=y_off+35; ay[1]=ay[0]+config->arrowsize[0]; y=ay[1]+config->arrowsize[0];
  48.             break;
  49.         case 2:
  50.             ay[0]=y_off+35; y=ay[0]+config->arrowsize[0]; ay[1]=y+height+4;
  51.             break;
  52.     }
  53.  
  54.     if (config->sliderwidth<8) config->sliderwidth=8;
  55.     else if (config->sliderwidth>108) config->sliderwidth=108;
  56.     if (config->sliderwidth%2) ++config->sliderwidth;
  57.  
  58.     x=x_off+244-(config->sliderwidth/2);
  59.  
  60.     for (a=0;a<2;a++) {
  61.         DoArrow(rp,
  62.             x-2,ay[a],
  63.             config->sliderwidth+4,config->arrowsize[0]-2,
  64.             screen_pens[config->arrowfg].pen,screen_pens[config->arrowbg].pen,a);
  65.         do3dbox(x-2,ay[a],config->sliderwidth+4,config->arrowsize[0]-2);
  66.     }
  67.  
  68.     Do3DBox(rp,
  69.         x,y+1,
  70.         config->sliderwidth,height,
  71.         screen_pens[config->sliderbgcol].pen,screen_pens[config->sliderbgcol].pen);
  72.     SetAPen(rp,screen_pens[config->slidercol].pen);
  73.     RectFill(rp,x,y+1,x+config->sliderwidth-1,y+height);
  74.     do3dbox(x-2,y,config->sliderwidth+4,height+2);
  75.  
  76.     SetAPen(rp,screen_pens[0].pen);
  77.     RectFill(rp,
  78.         x_off+184,y_off+33,
  79.         x-5,y_off+87);
  80.     RectFill(rp,
  81.         x+config->sliderwidth+4,y_off+33,
  82.         x_off+304,y_off+87);
  83. }
  84.  
  85. void showleftrightslider()
  86. {
  87.     int y,x,ax[2],a,width;
  88.  
  89.     if (config->arrowsize[1]<8) config->arrowsize[1]=8;
  90.     else if (config->arrowsize[1]>20) config->arrowsize[1]=20;
  91.  
  92.     width=97-(config->arrowsize[1]*2);
  93.  
  94.     switch (config->arrowpos[1]) {
  95.         case 0:
  96.             x=x_off+317; ax[0]=329+width; ax[1]=ax[0]+config->arrowsize[1]+6;
  97.             break;
  98.         case 1:
  99.             ax[0]=x_off+317; ax[1]=ax[0]+config->arrowsize[1]+6; x=ax[1]+config->arrowsize[1]+6;
  100.             break;
  101.         case 2:
  102.             ax[0]=x_off+317; x=ax[0]+config->arrowsize[1]+6; ax[1]=x+width+8;
  103.             break;
  104.     }
  105.  
  106.     if (config->sliderheight<5) config->sliderheight=5;
  107.     else if (config->sliderheight>49) config->sliderheight=49;
  108.     if (!(config->sliderheight%2)) ++config->sliderheight;
  109.  
  110.     y=(y_off+60)-(config->sliderheight/2);
  111.  
  112.     for (a=0;a<2;a++) {
  113.         DoArrow(rp,
  114.             ax[a],y-1,
  115.             config->arrowsize[1]+2,config->sliderheight+2,
  116.             screen_pens[config->arrowfg].pen,screen_pens[config->arrowbg].pen,3-a);
  117.         do3dbox(ax[a],y-1,config->arrowsize[1]+2,config->sliderheight+2);
  118.     }
  119.  
  120.     Do3DBox(rp,
  121.         x+2,y,
  122.         width,config->sliderheight,
  123.         screen_pens[config->sliderbgcol].pen,screen_pens[config->sliderbgcol].pen);
  124.     SetAPen(rp,screen_pens[config->slidercol].pen);
  125.     RectFill(rp,x+2,y,x+width+1,y+config->sliderheight-1);
  126.     do3dbox(x,y-1,width+4,config->sliderheight+2);
  127.  
  128.     SetAPen(rp,screen_pens[0].pen);
  129.     RectFill(rp,
  130.         x_off+313,y_off+33,
  131.         x_off+433,y-3);
  132.     RectFill(rp,
  133.         x_off+313,y+config->sliderheight+2,
  134.         x_off+433,y_off+87);
  135. }
  136.  
  137. void showstringgadget()
  138. {
  139.     int x,ax[2],a,y,width;
  140.  
  141.     if (config->arrowsize[2]<8) config->arrowsize[2]=8;
  142.     else if (config->arrowsize[2]>20) config->arrowsize[2]=20;
  143.  
  144.     width=96-(config->arrowsize[2]*2);
  145.  
  146.     switch (config->arrowpos[2]) {
  147.         case 0:
  148.             x=x_off+448; ax[0]=459+width; ax[1]=ax[0]+config->arrowsize[2]+6;
  149.             break;
  150.         case 1:
  151.             ax[0]=x_off+446; ax[1]=ax[0]+config->arrowsize[2]+6; x=ax[1]+config->arrowsize[2]+8;
  152.             break;
  153.         case 2:
  154.             ax[0]=x_off+446; x=ax[0]+config->arrowsize[2]+8; ax[1]=x+width+7;
  155.             break;
  156.     }
  157.  
  158.     if (config->stringheight<5) config->stringheight=5;
  159.     else if (config->stringheight>49) config->stringheight=49;
  160.  
  161.     y=(y_off+60)-(config->stringheight/2);
  162.  
  163.     for (a=0;a<2;a++) {
  164.         DoArrow(rp,
  165.             ax[a],y-1,
  166.             config->arrowsize[2]+2,config->stringheight+2,
  167.             screen_pens[config->arrowfg].pen,screen_pens[config->arrowbg].pen,3-a);
  168.         do3dbox(ax[a],y-1,config->arrowsize[2]+2,config->stringheight+2);
  169.     }
  170.  
  171.     SetAPen(rp,screen_pens[config->stringbgcol].pen);
  172.     RectFill(rp,x,y,x+width,y+config->stringheight-1);
  173.     Do3DStringBox(rp,
  174.         x,y,
  175.         width+1,config->stringheight,
  176.         screen_pens[config->gadgettopcol].pen,screen_pens[config->gadgetbotcol].pen);
  177.  
  178.     SetAPen(rp,screen_pens[0].pen);
  179.     RectFill(rp,
  180.         x_off+442,y_off+33,
  181.         x_off+562,y-3);
  182.     RectFill(rp,
  183.         x_off+442,y+config->stringheight+2,
  184.         x_off+562,y_off+87);
  185. }
  186.  
  187. void showarrowborders(active,old)
  188. int active,old;
  189. {
  190.     if (old>-1) {
  191.         SetAPen(rp,screen_pens[0].pen);
  192.         drawarrowrec(old);
  193.         SetAPen(rp,screen_pens[1].pen);
  194.     }
  195.     SetDrMd(rp,COMPLEMENT);
  196.     drawarrowrec(active);
  197.     SetDrMd(rp,JAM2);
  198. }
  199.  
  200. void drawarrowrec(a)
  201. int a;
  202. {
  203.     a*=129; a+=x_off+178;
  204.     RectFill(rp,a,y_off+30,a+132,y_off+31);
  205.     RectFill(rp,a,y_off+32,a+3,y_off+88);
  206.     RectFill(rp,a+129,y_off+32,a+132,y_off+88);
  207.     RectFill(rp,a,y_off+89,a+132,y_off+90);
  208. }
  209.  
  210. void fixarrowgads(active)
  211. int active;
  212. {
  213.     int a;
  214.  
  215.     for (a=0;a<3;a++) {
  216.         if (config->arrowpos[active]==a) arrowgadgets[a].Flags|=SELECTED;
  217.         else arrowgadgets[a].Flags&=~SELECTED;
  218.     }
  219.     RefreshGList(arrowgadgets,Window,NULL,3);
  220. }
  221.